Skip to content

Improve pipe handling of CMUX modem trace module#194

Merged
SeppoTakalo merged 2 commits into
nrfconnect:mainfrom
SeppoTakalo:cmux-trace-test
Mar 9, 2026
Merged

Improve pipe handling of CMUX modem trace module#194
SeppoTakalo merged 2 commits into
nrfconnect:mainfrom
SeppoTakalo:cmux-trace-test

Conversation

@SeppoTakalo
Copy link
Copy Markdown
Contributor

Improve handling of pipe open-close events of CMUX tracing module.

Allow TX timeout and drop policy to be defined by Kconfig.

Remove unnecessary loop from trace backend as nRF library already
loops on -EAGAIN.

Attach the pipe from CMUX module, this is cleaner as trace module is enough to just follow pipe events. Does not need to poll CMUX if its started or not.

Copy link
Copy Markdown
Contributor

@MarkusLassila MarkusLassila left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks promising. Checking the pipe idle before writing all but ensures that the traces will not affect the throughput of data.

However, we are also interested on getting reasonable traces out. I'll run some measurements with the changes.

Comment thread app/src/sm_trace_backend_cmux.c Outdated
* The nrf_modem_lib_trace.c:trace_fragment_write() handles
* retrying if the backend returns -EAGAIN.
*
* It is important to call trace_processed_callback(len) for
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When CMUX is congested, the trace fifos will easily overflow, and I don't think that there is anything wrong with that. They are dropping traces, same as we are doing here.

I do agree on calling the trace_processed_callback() for every fragment, but that does not ensure the trace fifos not overflowing.

@SeppoTakalo SeppoTakalo requested a review from a team March 2, 2026 08:11
Cherry-pick a usefull helper function from my modem_pipe branch.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
Improve handling of pipe open-close events of CMUX tracing module.

Allow TX timeout to be defined by Kconfig.

Remove unnecessary loop from trace backend as nRF library already
loops on -EAGAIN.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
Signed-off-by: Markus Lassila <markus.lassila@nordicsemi.no>
@MarkusLassila
Copy link
Copy Markdown
Contributor

Removed Kconfigs, they did not have any effect on trace quality.

@SeppoTakalo SeppoTakalo merged commit fb20dbe into nrfconnect:main Mar 9, 2026
3 checks passed
@SeppoTakalo SeppoTakalo deleted the cmux-trace-test branch March 9, 2026 14:04
@SeppoTakalo SeppoTakalo added the backport v1-branch Backport the PR to main branch. label Mar 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport v1-branch Backport the PR to main branch.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants